home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u1.d64
/
lister.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
3KB
|
102 lines
90 REM LISTER
100 DATA 19,147,17,145,29,157,18,146,20,148,141,32
110 REM 80-COLUM CURSOR STUFF
120 DATA 7,21,149,22,150,14,142,25,153
130 DATA 15,143
140 REM VIC STUFF
150 DATA 144,5,28,159,156,30,31,158
160 DATA 8,9,133,137,134,138,135,139,136,140
170 DATA HOME,CLEAR,DOWN,UP,RIGHT,LEFT,RVS,RVOFF,DEL,INST,RETURN,SPACE
180 DATA BELL,D.LINE,I.LINE,ER.BEGIN,ER.END,TEXT,GRAPHIC,SCROLL.UP,SCROLL.DOWN
190 DATA TOP,BOTTOM
200 DATA BLACK,WHITE,RED,CYAN,MAGENTA,GREEN,BLUE,YELLOW
210 DATA LOCK,UNLOCK,F1,F2,F3,F4,F5,F6,F7,F8
220 DIMA(40),A$(40),K$(90):POKE53281,0:POKE53280,11:PRINT"[147]"
230 FORJ=0TO40:READA(J):NEXTJ
240 FORJ=0TO40:READA$(J):NEXTJ
250 DATA END,FOR,NEXT,DATA,INPUT#,INPUT,DIM,READ,LET,GOTO,RUN,IF,RESTORE,GOSUB
260 DATA RETURN,REM,STOP,ON,WAIT,LOAD,SAVE,VERIFY,DEFINE,POKE,PRINT#,PRINT,CONTINUE
270 DATA LIST,CLR,CMD,SYS,OPEN,CLOSE,GET,NEW,TAB(,TO,FN,SPC(,THEN,NOT,STEP
280 DATA +,-,*,/,^,AND,OR,>,=,<,SGN,INT,ABS,USR,FRE,POS,SQR,RND,LOG,EXP,COS
290 DATA SIN,TAN,ATN,PEEK,LEN,STR$,VAL,ASC,CHR$,LEFT$,RIGHT$,MID$,GO,CONCAT
300 DATA DOPEN,DCLOSE,RECORD,HEADER,COLLECT,BACKUP,COPY,APPEND,DSAVE,CATALOG
310 DATA RENAME,SCRATCH,DIRECTORY
320 FORJ=0TO89:READK$(J):NEXTJ
400 CLOSE1:INPUT"NAME OF PROGRAM FILE ?";G$
410 OPEN1,8,3,G$+",P,R"
420 GET#1,A$,B$
430 IFA$<>CHR$(1)ANDA$<>""THEN400
440 IFA$=""THENA$=CHR$(1):GET#1,X$
450 INPUT"LINE NUMBER RANGE ? [157][157][157]";Z$
460 L0=0:L1=0:L2=1E9
470 FORJ=1TOLEN(Z$):Y$=MID$(Z$,J,1)
480 Y=ASC(Y$):IFY>=48ANDY<=57GOTO510
490 IFY=32THEN510
500 L0=J:IFY<>45THEN600
510 NEXTJ
520 IFL0<LEN(Z$)THENL2=VAL(MID$(Z$,L0+1)):IFL2=0THENL2=1E9
530 IFL0>1THENL1=VAL(Z$)
540 IFL0=0THENL1=L2
600 P3$="[":P4$="]":INPUT"LIST TO PRINTER N[157][157][157]";Z$
610 P=3:IFASC(Z$)=89THENP=4:L$="":P3$=CHR$(219):P4$=CHR$(221)
620 P1$="[":P2$="]":INPUT"GRAPHICS OR TEXT G[157][157][157]";Z$
630 POKE53272,21:IFASC(Z$)=84THENPOKE53272,23:M$=L$:P1$=P3$:P2$=P4$
640 INPUT"TRANSLATE CURSOR MOVES N[157][157][157]";Z$
650 IFASC(Z$)=89THENT7=1
660 OPEN4,P:F$=P1$
670 J=80:IFP<>3GOTO690
680 PRINT"[147]":PRINT"++++++++++++":FORJ=1TO81:IFPEEK(1024+J)=32THENNEXTJ
690 L9=J:PRINT#4,"PROGRAM: ";G$
700 REM NEW LINE
710 GOSUB2010:Q=0:T1=1:C1=-1:GET#1,A$,B$:IFST<>0THEN3000
720 IFB$=""GOTO3000
730 GET#1,A$,B$
740 L=ASC(A$+CHR$(0))+ASC(B$+CHR$(0))*256
750 IFL<L1THEN1080
760 IFL>L2THEN3000
770 F2=1:PRINT#4,M$;P$:P$=STR$(L)+" "
800 REM START TEXT HERE
810 GET#1,A$:IFA$=""GOTO710
820 T=0:A=ASC(A$):IFA=32ANDF$=","GOTO840
830 IFQ=0OR(AAND127)>31ORT7=0THEN900
840 FORJ=0TO40:IFA=A(J)THENB$=A$(J):GOTO860
850 NEXTJ:GOTO1000
860 IFB$=B1$THENB=B+1:GOTO810
870 IFB>0THENA$=MID$(STR$(B+1),2)+F$+B$:GOTO890
880 A$=F$+B$
890 B=0:B1$=B$:F$=",":F1=1:GOTO1010
900 A=A-128:IFA<0ORQ<>0GOTO1000
910 IFA=127THENA$="":GOTO1000
920 T=1:A$=K$(A)
930 IFA=15THENQ=2
1000 GOSUB2010
1010 IFA$=CHR$(34)THENQ=1-Q
1020 REM C=-1 FOR ALPHANUMERIC
1030 C=ASC(LEFT$(A$,1)):C=(C<48ORC>57)AND(C<65ORC>90)
1040 IFT<>T1ORT=1THENT1=T:IF NOT C AND NOT C1 THENP$=P$+" ":GOSUB2500
1050 C=ASC(RIGHT$(A$,1)):C1=((C<48ORC>57)AND(C<65ORC>90))ORA=37
1060 P$=P$+A$:GOSUB2500
1070 GOTO810
1080 REM SKIP TO NEXT LINE
1090 GET#1,A$:IFA$=""THEN710
1100 GOTO1090
2000 REM CLOSE OFF CURSOR EXPRESSION
2010 IFF1=0GOTO2040
2020 IFB>0THENP$=P$+MID$(STR$(B+1),2):GOSUB2500
2030 B=0:F1=0:B1$="":P$=P$+P2$:GOSUB2500:F$=P1$
2040 RETURN
2500 IFLEN(P$)<L9GOTO2600
2510 FORJ=L9TOL9*.6STEP-1
2520 IFMID$(P$,J,1)=":"GOTO2580
2530 NEXTJ:FORJ=L9-1TOL9*.6-1STEP-1
2540 P=ASC(MID$(P$,J))
2550 IFP=91GOTO2580
2560 IFP=59ORP=44ORP=93THENJ=J+1:GOTO2580
2570 NEXTJ:J=L9-1
2580 PRINT#4,M$;LEFT$(P$,J-1)
2590 P$=" "+MID$(P$,J)
2600 RETURN
3000 IFLEN(P$)>0THENF2=1:PRINT#4,M$;P$
3010 IFF2=0THENPRINT"** NO LINES FOUND **"
3020 CLOSE1:GOSUB2000:CLOSE4